package com.my.study.listener;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEvent;

/**
 * @author Carlos
 * @version 1.0.0
 * @date 2022/3/1 22:09
 */
public class CustomPublisher implements ApplicationContextAware {

    private ApplicationContext applicationContext;

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }

    public void publisher(ApplicationEvent event) {
        applicationContext.publishEvent(event);
    }

}
